<?php


class TestOfCurrencies extends UnitTestCase {
	
	private $currencies;
	
	function __construct() {
		$this->currencies = ServiceLocator::getService( 'Currencies' );
	}

	function testShouldReturnDefaultCurrency() {
		$test = $this->currencies->getDefaultCurrency();
		$this->assertEqual($test, "USD");
	}
	
	function testShouldReturnCorrectFormat() {
		$test1 = $this->currencies->format(299.9900);
		$this->assertEqual($test1, "$299.99");
		
		$test2 = $this->currencies->format(15, true, "USD");
		$this->assertEqual($test2, "$15.00");
		
		$test3 = $this->currencies->format(299.9900, true, "EUR");
		$priceWithCurrency = round((299.990 * 0.74129999), 2);
		$this->assertEqual($test3, "&euro;" . $priceWithCurrency);
	}
	
}

?>
